package oop3;

//最多100个选民
public class Voter {
	private String name;// 选民名字
	private boolean isVoted = false;// 是否投过
	private static int count = 0;// 计数器

	public static int getCount() {
		return count;
	}

	public Voter(String name) {
		this.name = name;

	}

	public void voteTo(String houxuanren) {

		if (count > 100) {
			System.out.println("票数已满");
			return;
		}
		if (isVoted) {
			System.out.println(name + "投过了");
			return;
		}

		isVoted = true;

		count++;
		System.out.println(name + "投票给了" + houxuanren);

	}

}
